home *** CD-ROM | disk | FTP | other *** search
- page 60,132
- TITLE STFIX - Resident routine to give ST100.EXE what it wants.
- ;-------------------------------------------------------------------
- ;
- ; Install this routine to catch calls to INT 13H for drive
- ; A:, track 40. This routine makes ST100.EXE think that
- ; it got what it wanted. Use for SMARTERM 100 ver. 4.0c
- ;
- ; by Keith M. Bailey 12/29/85 version 0.01
- ;
- ;-------------------------------------------------------------------
- CODESG SEGMENT
- ASSUME CS:CODESG,DS:NOTHING,ES:NOTHING
- ORG 0100H
- STFIX PROC FAR
- JMP START
-
- ORG 0110H
- FILE1 LABEL BYTE
- SECTORS DB 0400H*9 DUP('?') ;Space to store decoded sectors
-
- OFF_13H DW 00 ;Store offset for original INT 13H
- SEG_13H DW 00 ;Store segment for original INT 13H
- ON DB 00 ;Flag to indicate if trapping is used
-
-
- ;New routine for INT 13H
-
- NEW_13H:
- STI ;Enable interrupts
- PUSHF ;Save flags
- CMP AH,00 ;Is it a reset ?
- JE RESET ; Yes
- CMP CH,27H ;Call for track 39 ?
- JE TRCK39 ; Yes
- CMP CH,28H ;Call for track 40 ?
- JNE NOTRAP ; No
- CMP DL,00 ;Call for drive A: ?
- JNE NOTRAP ; No
- CMP ON,0FFH ;Is flag set (ON = FFH) ?
- JE TRAP ; Yes
-
- NOTRAP: POPF ;No trapping ... just go to old INT 13H
- PUSHF ;Give something for INT 13H to pop on return
- CALL DWORD PTR CS:OFF_13H ;Original INT 13H
- RET 2 ;Return and throw away flags
-
- TRCK39: CMP ON,00 ;Is flag off
- JE NOTRAP ; Yes
- CMP AH,04 ;Is it a verify ?
- JNE NOTRAP ; No
- CMP DL,00 ;Call for drive A: ?
- JNE NOTRAP ; No
- POPF
- MOV AX,0F206H ;Set flags for no error.
- PUSH AX
- POPF
- MOV AX,00 ;Set AH for no error.
- RET 2 ;Return and throw away flags
-
- RESET: CMP ON,00 ;Is flag off
- JE NOTRAP ; Yes
- POPF ;Restore flags
- PUSH DX ;CX and DX aren't changed
- PUSH CX
- MOV DX,0000 ;Set up AX, CX, and DX for a reset
- MOV CX,005CH ; that I know works !
- MOV AX,00FDH
- PUSHF ;Give something for INT 13H to pop on return
- CALL DWORD PTR CS:OFF_13H ;Original INT 13H
- POP CX ;Restore CX and DX ... others are okay
- POP DX
- RET 2 ;Return and throw away flags
-
- TRAP: POPF ;Trap for calls from ST100.EXE
- PUSH DS ;Save segments and registers
- PUSH DI
- PUSH SI
- PUSH DX
- PUSH CX
- PUSH BX
- CMP AH,04 ;Is it a verify operation ?
- MOV AX,00
- MOV DS,AX ;Set DS = 0000
- LDS SI,DS:[1EH*4] ;DS:SI points to disk parameter table
- JE VERIFY ; Yes - a verify operation
- ; No - a read operation
- DEC CL ;Decrease sector to read by one
- MOV CH,00 ;CX = # sectors offset from 1
- MOV AX,0400H ;Number of bytes per sector
- MUL CX ;DX:AX has product ... AX is offset from FILE1
- MOV CX,0200H ;Number of bytes to be read
- CMP BYTE PTR DS:[SI+3],02 ;Is # bytes = 0200H ?
- JE SMALL ; Yes
- MOV CX,0400H ; No --- # bytes to read = 0400H
-
- SMALL: MOV DI,BX ;ES:DI points to buffer to move segment into
- MOV DX,CS
- MOV DS,DX ;Set DS = CS
- MOV SI,OFFSET FILE1 ;Start of segments
- ADD SI,AX ;Add offset calculated above
- CLD
- REPNZ MOVSB ;Move the correct # of bytes into buffer
-
- MOV AX,00
- MOV DS,AX ;Set DS = 0000
- LDS SI,DS:[1EH*4] ;DS:SI points to disk parameters
-
- VERIFY: CMP BYTE PTR DS:[SI+3],03 ;1024 byte sectors ?
- JE VERERR ; Yes - operation sets error condition
- TR9V: MOV AX,0F246H ;Set flags for return - no error
- PUSH AX
- POPF
- MOV AX,00 ;Set AX for return - no error
- JMP BYE ;Leave
-
- VERERR: CMP CL,09 ;Is it for sector 9 ?
- JE TR9V ; Yes - no error from operation !
- MOV AX,0F247H ;Set flags for return - error
- PUSH AX
- POPF
- MOV AX,1000H ;Set AX for return - CRC error
-
- BYE: POP BX ;Restore flags and segments
- POP CX
- POP DX
- POP SI
- POP DI
- POP DS
- RET 2 ;Return ... throw away flags
-
-
- ;Routine to load resident portion
-
- START: MOV AX,00
- MOV DS,AX ;Set DS to 0000
- MOV DX,OFFSET ALLRDY ;Point to error message
- LDS SI,DS:[13H*4] ;Point to INT 13H
- CMP WORD PTR DS:[SI],9CFBH ;Is STFIX installed ?
- JE NOTRES ; Yes - don't install
-
- RESID: CLI ;Disable interrupts while
- ; changing interrupt vectors
- MOV CS:OFF_13H,SI ;Move offset for INT 13H
- ; into memory location
- MOV CS:SEG_13H,DS ;Move segment for INT 13H
- MOV AX,00 ; into memory location
- MOV DS,AX ;Set DS to 0000
- MOV WORD PTR DS:[13H*4],OFFSET NEW_13H ;Set INT 13H offset
- MOV DS:[13H*4+2],CS ;Set INT 13H segment
- STI ;Enable interrupts
-
- MOV DX,OFFSET INSTLL ;Point to installed message
- MOV AX,CS ;DS:DX points to string
- MOV DS,AX
- MOV AH,09H
- INT 21H ;Print string
-
- MOV DX,OFFSET START ;Move into DX size of memory
- ; to protect
- INT 27H ;Terminate, but remain resident
-
-
- NOTRES: CMP WORD PTR DS:[SI+2],0FC80H ;Make sure it's mine
- JNE RESID ; No - install
- MOV AX,CS ;DS:DX points to string
- MOV DS,AX
- MOV AH,09H
- INT 21H ;Print string
- INT 20H ;Terminate
-
- STFIX ENDP
-
- ALLRDY DB 0DH,0AH,'STFIX has already been installed. Use STFIXON to '
- DB 'toggle ON and OFF.',0DH,0AH,'$'
- INSTLL DB 0DH,0AH,'STFIX is now installed. Use STFIXON to '
- DB 'toggle ON and OFF.',0DH,0AH,'$'
-
- CODESG ENDS
- END STFIX
-